﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ProDeletor
{
    class Log
    {
        //private string logFileName;
        private TextWriter logFile;

        public Log(string path)
        {
            try
            {
                if (!File.Exists(path))
                {
                    StreamWriter file = File.CreateText(path);
                    file.WriteLine("Logfile created: " + DateTime.Now);
                    file.Close();
                }
                logFile = File.AppendText(path);
            }
            catch
            {
                //TODO: something
            }
        }

        public void write(string description)
        {
            try
            {
                logFile.WriteLine(DateTime.Now + " : " + description);
            }
            catch
            {
                //TODO: something
            }
        }

        public void close()
        {
            try
            {
                logFile.Flush();
                logFile.Close();
            }
            catch
            {
                //TODO: something
            }
        }
    }
}
